- content_for :meta do
  %meta{:name => "Description", :content => "These are are the photos taken by Suttons Bay Photographer Dan Stewart. Each of these photos are part of galleries which can be found in the photo galleries section of this site"}
  %meta{:name => "Abstract", :content => "Photos taken by Dan Stewart"}
  %meta{:name => "Keywords", :content => "Photos, Suttons Bay, Dan Stewart, Photographer, Northern Michigan"}
- content_for :title do
  = "all photos"
- content_for :head do
  = javascript_include_tag  'mootools-1.2.1-core.js'
  = javascript_include_tag  'mootools-1.2-more.js'
  = stylesheet_link_tag 'pagination'
  %script{:type => "text/javascript"}
    ="window.addEvent('domready', function(){"
    ="  $$('.edit').each(function(item){"
    ="    item.addEvent('click', function(){toggleSliders();});"
    ="  });"
    ="  $$('.check_boxes').each(function(item){"
    ="    var thisSlider = new Fx.Slide(item, {duration: 500});"
    ="    thisSlider.hide();"
    ="  });"
    ="  $$('.photo_mass_edit_options_wrapper').each(function(options_box){"
    ="    var thisSlider = new Fx.Slide(options_box, {duration: 500});"
    ="    thisSlider.hide();"
    ="  });"
    ="  function toggleSliders(){"
    ="    $$('.check_boxes').each(function(item){"
    ="      var check_boxes = new Fx.Slide(item, {duration: 500});"
    ="      check_boxes.toggle();"
    ="    });"
    ="    $$('.photo_mass_edit_options_wrapper').each(function(options_box){"
    ="      var thisSlider = new Fx.Slide(options_box, {duration: 500});"
    ="      thisSlider.toggle();"
    ="    });"
    ="  }"
    ="});"
%div.photo_page_title_wrapper
  %h1 All Photos
  %div.page_info
    = page_entries_info @photos
  %div.photo_edit_options_link
    [
    %a.edit Make mass changes to these photos
    ]
%div.photos
  - form_tag update_many_photos_url, :method => 'put' do
    %div.photo_mass_edit_options_wrapper
      %p Set the options you want to set, then check the photos (below) to which you want to apply these options.
      %div.photo_mass_edit_options
        %table
          %tr
            %td Add to Gallery:
          %tr
            %td
              %select{:name => "gallery_id"}
                %option{:value => ""}= "Choose a gallery"
                - @galleries.each do |gallery|
                  %option{:value => gallery.id}= gallery.name[0..25]+"..."
      %div.photo_mass_edit_options
        %table
          %tr
            %td Random:
            %td= radio_button_tag("photo[random]", 1)
          %tr
            %td Not Random:
            %td= radio_button_tag("photo[random]", 0)
      %div.photo_mass_edit_options
        %table
          %tr
            %td Thumbnail:
            %td= radio_button_tag("photo[is_thumbnail]", 1)
          %tr
            %td Not Thumbnail
            %td= radio_button_tag("photo[is_thumbnail]", 0)
      %div.photo_mass_edit_options
        %table
          %tr
            %td Purchasable:
            %td= radio_button_tag("photo[non_purchasable]", 0)
          %tr
            %td Not Purchasable:
            %td= radio_button_tag("photo[non_purchasable]", 1)
      %div.photo_mass_edit_options
        %table
          %tr
            %td Private:
            %td= radio_button_tag("photo[is_private]", 1)
          %tr
            %td Not Private:
            %td= radio_button_tag("photo[is_private]", 0)
      %div.photo_mass_edit_options
        %table
          %tr
            %td Delete:
            %td= check_box_tag("delete")
      %div.photo_mass_edit_options
        %table
          %tr
            %td= submit_tag "save changes"
    - @photos.each do |photo|
      %table.photo
        %tr
          %td.photo
            %a{:href => photo_url(photo), :title => (photo.caption ? photo.caption : photo.filename), :alt => (photo.caption ? photo.caption : photo.filename)}
              %img.photo_thumb{:src => photo.public_filename(:thumb), :title => (photo.caption ? photo.caption : photo.filename), :alt => (photo.caption ? photo.caption : photo.filename)}
            %div.check_boxes
              = check_box_tag 'photo_ids[]', photo.id
%div.pagination
  = will_paginate @photos, :class => "flickr_pagination"